
/**
 * Copyright (c) subnew
 * Licensed under the GPL;
 * @email:joseanluo@gmail.com
 * @Title: SpringmvcContextHolderUtil.java
 * @Package com.subnew.copyman.frame.utils.web
 */
package com.subnew.mango.frame.utils.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

/**
 * Spring MVC 上下文获取工具类。
 * @author JoseanLuo
 * @date  2014-7-19 下午9:58:50
 * @history new 
 * @version V1.0 
 */
public class SpringmvcContextHolderUtil {
	/**
	 * 取得当前Request
	* @return   the request.
	* @author JoseanLuo  
	* @date 2014-7-19 下午10:05:53
	* @version V1.0
	 */
  public static HttpServletRequest getRequest(){
	  return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
  }
  /**
  * 取得当前Session.
  * @return   
  * @author JoseanLuo  
  * @date 2014-7-19 下午10:07:06
  * @version V1.0
   */
  public static HttpSession getSession(){
	  return getRequest().getSession();
  }
  
}